package psnl.bingo.bgtool.model.constant;

import psnl.bingo.bgtool.model.dto.UserInfo;

import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

public class ConstSys {
    public static Map<String, UserInfo> users = new HashMap<>();
    static {
        users.put("guest", new UserInfo("guest", "guest123"));
        users.put("admin", new UserInfo("admin", "adminTool"));
    }

    public static UserInfo findUser(String userName) {
        UserInfo userInfo = users.get(userName);
        if(null == userInfo) {
            return null;
        }

        if("guest".equals(userInfo.getName())) {
            LocalDate date = LocalDate.now();
            if(date.toString().compareTo("2025-12-12") > 0) {
                return new UserInfo(null, null);
            }
        }

        return userInfo;
    }

}
